<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
    <head>
		<base href="<%=basePath%>" />
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<meta name="apple-mobile-web-app-title" content="Amaze UI" />
		<link rel="stylesheet" href="layui/css/layui.css" media="all"> <!-- 适应所有设备 -->
		<style type="text/css">
		</style>
	</head>
	<% String nowDay = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); %>
	<body>
	    <br/>
        <div class="layui-form-item">
			<div class="layui-input-inline">
				<input type="text" name="playerID2" id="playerID2" placeholder="搜寻代理详细信息"
					autocomplete="off" class="layui-input">
			</div>

			<div class="layui-inline">
				<div class="layui-input-inline">
					<button class="layui-btn layui-btn-normal" data-type="reload"
						id="SelectOrder2" lay-filter="SelectOrder2">搜索</button>
				</div>
			</div>
		</div>
		<table class="layui-table" id="Detailquery" lay-filter="Detailquery">
		<caption style="color:#d71345">代理详细查询</caption>
		</table>
		
		<script src="js/jquery.min.js"></script>
		<script src="layui/layui.js"></script>
		<script>
		    layui.use(['layer','form','table'],function(){
		    	var layer = layui.layer,
		    	    form  = layui.form,
		    	    table = layui.table;
		    	
		    	layer.config({
					extend: 'MySkin/style.css'
				});
		    	
		    	//代理信息详细查询
		    	table.render({
		    		elem:'#Detailquery',
		    		method:'post',
		    		title:'代理详细查询',
		    		url:'agent/Detailquery',
		    		skin: 'row',
		    		even: true,
		    		page : true,//分页
		    		id:'AllTable3',
		    		request:{
						pageName:'PageIndex',
						limitName:'PageCount'
					},
					where:{
						UserId : $('#playerID2').val()
					},
		    		cols:[[
		    			{field:'UserId',title:'ID',style:'color:#d71345'},
		    			{field:'Nickname',title:'昵称',style:'color:#f47920'},
		    			{field:'TotalRecharge',title:'充值总额(元)',style:'color:#f05b72'},
		    			{field:'TotalContribution',title:'总贡献',style:'color:#1d953f'},
		    			{field:'TodayRecharge',title:'当天充值',style:'color:#009ad6'},
		    			{field:'TodayContribution',title:'当天贡献',style:'color:#5c7a29'},
		    			{field:'AgentLevel',title:'代理级别',style:'color:#5c7a29'}
		    			]],
		    			response:{
							statusCode : 200
						},
						parseData:function(res){
							return{
								"code":res.status,
								"msg":res.message,
								"count":res.count,
								"data":res.data
							};
						}
		    	});
		    	
		    	
		    	//定时刷新数据
				setInterval(function(){
					table.reload('AllTable3', {});
	              },60000);
		    	
		    	
		    	
				var active2 = {
						reload: function() {
							//获取用户名
							//执行重载
							table.reload('AllTable3', {
								page: {
									curr: 1 //重新从第 1 页开始
								}
								//根据条件查询
								,
								where: {
									UserId : $('#playerID2').val()
								}
							});
							return false;
						}
					};
				
				//点击搜索按钮根据用户名称查询
				$('#SelectOrder2').on('click',
					function() {
						var type = $(this).data('type');
						active2[type] ? active2[type].call(this) : '';
					});
		    });
		</script>
</body>
</html>